﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ketnoidulieu
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }
        clssQLDiem obj = new clssQLDiem();
        DataSet dslop = new DataSet();
        DataSet dssv = new DataSet();
        private void Form3_Load(object sender, EventArgs e)
        {
            dslop = obj.laydulieu("select * from Lop");
            cbbdslop.DataSource = dslop.Tables[0];
            cbbdslop.DisplayMember = "TenLop";
            cbbdslop.ValueMember = "MaLop";
            cbbdslop.SelectedIndex = -1;
        }

        private void cbbdslop_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbbdslop.SelectedIndex != -1)
            {
                string malop = cbbdslop.SelectedValue.ToString();
                string sql = "select * from SinhVien where malop='"+malop+"'";
                dssv = obj.laydulieu(sql);
                dgv1.DataSource = dssv.Tables[0];
            }
        }
    }
}
